from settings import *

def set_alpha(image, alpha):
    data = image.getdata()
    new_data = [(item[0], item[1], item[2], min(item[3], int(alpha * 255))) for item in data]
    image.putdata(new_data)
    return image

def save_image(image, path):
    image = image.convert('RGBA')
    image = set_alpha(image, ALPHA)
    image.save(path)